<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: MPU Functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__prot__functions__mpu.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">MPU Functions<div class="ingroups"><a class="el" href="group__group__prot.html">Prot         (Protection Unit)</a> &raquo; <a class="el" href="group__group__prot__functions.html">Functions</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga8b368e9846d5a3b8cd284131562376b1"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__prot__enums.html#ga13ede85383a4afaf5ed3a14b470e38bd">cy_en_prot_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__prot__functions__mpu.html#ga8b368e9846d5a3b8cd284131562376b1">Cy_Prot_ConfigMpuStruct</a> (<a class="el" href="struct_p_r_o_t___m_p_u___m_p_u___s_t_r_u_c_t___type.html">PROT_MPU_MPU_STRUCT_Type</a> *base, const <a class="el" href="structcy__stc__mpu__cfg__t.html">cy_stc_mpu_cfg_t</a> *config)</td></tr>
<tr class="memdesc:ga8b368e9846d5a3b8cd284131562376b1"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function configures a memory protection unit (MPU) struct with its protection attributes.  <a href="#ga8b368e9846d5a3b8cd284131562376b1">More...</a><br /></td></tr>
<tr class="separator:ga8b368e9846d5a3b8cd284131562376b1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf86849b6ef266090238dc4f5d59161f2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__prot__enums.html#ga13ede85383a4afaf5ed3a14b470e38bd">cy_en_prot_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__prot__functions__mpu.html#gaf86849b6ef266090238dc4f5d59161f2">Cy_Prot_EnableMpuStruct</a> (<a class="el" href="struct_p_r_o_t___m_p_u___m_p_u___s_t_r_u_c_t___type.html">PROT_MPU_MPU_STRUCT_Type</a> *base)</td></tr>
<tr class="memdesc:gaf86849b6ef266090238dc4f5d59161f2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enables the MPU struct, which allows the MPU protection attributes to take effect.  <a href="#gaf86849b6ef266090238dc4f5d59161f2">More...</a><br /></td></tr>
<tr class="separator:gaf86849b6ef266090238dc4f5d59161f2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga515c855a5703ee9dd3dd905aa50367a1"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__prot__enums.html#ga13ede85383a4afaf5ed3a14b470e38bd">cy_en_prot_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__prot__functions__mpu.html#ga515c855a5703ee9dd3dd905aa50367a1">Cy_Prot_DisableMpuStruct</a> (<a class="el" href="struct_p_r_o_t___m_p_u___m_p_u___s_t_r_u_c_t___type.html">PROT_MPU_MPU_STRUCT_Type</a> *base)</td></tr>
<tr class="memdesc:ga515c855a5703ee9dd3dd905aa50367a1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disables the MPU struct, which prevents the MPU protection attributes from taking effect.  <a href="#ga515c855a5703ee9dd3dd905aa50367a1">More...</a><br /></td></tr>
<tr class="separator:ga515c855a5703ee9dd3dd905aa50367a1"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga8b368e9846d5a3b8cd284131562376b1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8b368e9846d5a3b8cd284131562376b1">&#9670;&nbsp;</a></span>Cy_Prot_ConfigMpuStruct()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__prot__enums.html#ga13ede85383a4afaf5ed3a14b470e38bd">cy_en_prot_status_t</a> Cy_Prot_ConfigMpuStruct </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_p_r_o_t___m_p_u___m_p_u___s_t_r_u_c_t___type.html">PROT_MPU_MPU_STRUCT_Type</a> *&#160;</td>
          <td class="paramname"><em>base</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structcy__stc__mpu__cfg__t.html">cy_stc_mpu_cfg_t</a> *&#160;</td>
          <td class="paramname"><em>config</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function configures a memory protection unit (MPU) struct with its protection attributes. </p>
<p>The protection structs act like the gatekeepers for a master's accesses to memory, allowing only the permitted transactions to go through.</p>
<dl class="section note"><dt>Note</dt><dd>This function is applicable for both CPUSS ver_1 and ver_2.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The base address for the MPU struct being configured.</td></tr>
    <tr><td class="paramname">config</td><td>Initialization structure containing all the protection attributes.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Status of the function call.</dd></dl>
<table class="doxtable">
<tr>
<th>Status </th><th>Description  </th></tr>
<tr>
<td>CY_PROT_SUCCESS </td><td>The MPU struct was configured. </td></tr>
<tr>
<td>CY_PROT_FAILURE </td><td>Configuration failed due to a protection violation. </td></tr>
</table>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    {</div><div class="line">        <span class="comment">/* Scenario: Crypto bus master must not be able access the memory region </span></div><div class="line"><span class="comment">                     0x08000020 ~ 0x080000FF unless it is operating in privileged</span></div><div class="line"><span class="comment">                     and secure mode */</span></div><div class="line">        </div><div class="line">        <a class="code" href="structcy__stc__mpu__cfg__t.html">cy_stc_mpu_cfg_t</a> mpuCfg = {</div><div class="line">            <span class="comment">/*.address =*/</span> (uint32_t *)0x08000000UL,    <span class="comment">/* Starting address at start of SRAM */</span></div><div class="line">            <span class="comment">/*.regionSize =*/</span> <a class="code" href="group__group__prot__enums.html#ggaad39ed0d259460f717edfe9d08fc005fac95822db72eb8b6b16cd97f84c0d0b12">CY_PROT_SIZE_256B</a>,        <span class="comment">/* Protect block of 256 Bytes */</span></div><div class="line">            <span class="comment">/*.subregions =*/</span> <a class="code" href="group__group__prot__enums.html#gga618195213f866568fb71ed14af59cf6ca9b41ba059d2baba289e8776d46cea7ef">CY_PROT_SUBREGION_DIS0</a>,   <span class="comment">/* Disable protection for first 32 (256/8) Bytes */</span></div><div class="line">            <span class="comment">/*.userPermission =*/</span> <a class="code" href="group__group__prot__enums.html#gga330789bc5242c26b8a32df63fa8720e5a71e68b733a505b1241d49c8f62cbfb61">CY_PROT_PERM_DISABLED</a>,<span class="comment">/* Disallow all user mode accesses */</span></div><div class="line">            <span class="comment">/*.privPermission =*/</span> <a class="code" href="group__group__prot__enums.html#gga330789bc5242c26b8a32df63fa8720e5aa60056a96ee4d8d2133b69e3714a318b">CY_PROT_PERM_RWX</a>,     <span class="comment">/* Allow all privileged mode accesses */</span></div><div class="line">            <span class="comment">/*.secure =*/</span> <span class="keyword">true</span>                          <span class="comment">/* Require the bus master to have &quot;secure&quot; attribute */</span></div><div class="line">        };</div><div class="line">        </div><div class="line">        <span class="comment">/* Configure the Crypto (CPUSS_MS_ID_CRYPTO = 1) MPU struct #0 */</span></div><div class="line">        <span class="keywordflow">if</span>(<a class="code" href="group__group__prot__enums.html#gga13ede85383a4afaf5ed3a14b470e38bda462f07fcb31ed8a07dd273af4290691d">CY_PROT_SUCCESS</a> != <a class="code" href="group__group__prot__functions__mpu.html#ga8b368e9846d5a3b8cd284131562376b1">Cy_Prot_ConfigMpuStruct</a>(PROT_MPU1_MPU_STRUCT0, &amp;mpuCfg))</div><div class="line">        {</div><div class="line">            <span class="comment">/* Insert error handling */</span></div><div class="line">        }</div><div class="line">        <span class="keywordflow">else</span></div><div class="line">        {</div><div class="line">            <span class="comment">/* Enable the Crypto MPU struct #0 */</span></div><div class="line">            <span class="keywordflow">if</span>(<a class="code" href="group__group__prot__enums.html#gga13ede85383a4afaf5ed3a14b470e38bda462f07fcb31ed8a07dd273af4290691d">CY_PROT_SUCCESS</a> != <a class="code" href="group__group__prot__functions__mpu.html#gaf86849b6ef266090238dc4f5d59161f2">Cy_Prot_EnableMpuStruct</a>(PROT_MPU1_MPU_STRUCT0))</div><div class="line">            {</div><div class="line">                <span class="comment">/* Insert error handling */</span></div><div class="line">            }</div><div class="line">        }</div><div class="line">    }</div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="gaf86849b6ef266090238dc4f5d59161f2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf86849b6ef266090238dc4f5d59161f2">&#9670;&nbsp;</a></span>Cy_Prot_EnableMpuStruct()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__prot__enums.html#ga13ede85383a4afaf5ed3a14b470e38bd">cy_en_prot_status_t</a> Cy_Prot_EnableMpuStruct </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_p_r_o_t___m_p_u___m_p_u___s_t_r_u_c_t___type.html">PROT_MPU_MPU_STRUCT_Type</a> *&#160;</td>
          <td class="paramname"><em>base</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enables the MPU struct, which allows the MPU protection attributes to take effect. </p>
<dl class="section note"><dt>Note</dt><dd>This function is applicable for both CPUSS ver_1 and ver_2.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The base address of the MPU struct being configured.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Status of the function call.</dd></dl>
<table class="doxtable">
<tr>
<th>Status </th><th>Description  </th></tr>
<tr>
<td>CY_PROT_SUCCESS </td><td>The MPU struct was enabled. </td></tr>
<tr>
<td>CY_PROT_FAILURE </td><td>The MPU struct is disabled and possibly locked. </td></tr>
</table>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"></div><div class="line">    <span class="comment">/* Scenario: PROT_MPU1_MPU_STRUCT0 is configured to protect a resource and</span></div><div class="line"><span class="comment">                 needs to be enabled. */</span></div><div class="line"></div><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__prot__enums.html#gga13ede85383a4afaf5ed3a14b470e38bda462f07fcb31ed8a07dd273af4290691d">CY_PROT_SUCCESS</a> != <a class="code" href="group__group__prot__functions__mpu.html#gaf86849b6ef266090238dc4f5d59161f2">Cy_Prot_EnableMpuStruct</a>(PROT_MPU1_MPU_STRUCT0))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div><div class="line"></div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="ga515c855a5703ee9dd3dd905aa50367a1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga515c855a5703ee9dd3dd905aa50367a1">&#9670;&nbsp;</a></span>Cy_Prot_DisableMpuStruct()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__prot__enums.html#ga13ede85383a4afaf5ed3a14b470e38bd">cy_en_prot_status_t</a> Cy_Prot_DisableMpuStruct </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_p_r_o_t___m_p_u___m_p_u___s_t_r_u_c_t___type.html">PROT_MPU_MPU_STRUCT_Type</a> *&#160;</td>
          <td class="paramname"><em>base</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Disables the MPU struct, which prevents the MPU protection attributes from taking effect. </p>
<dl class="section note"><dt>Note</dt><dd>This function is applicable for both CPUSS ver_1 and ver_2.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">base</td><td>The base address of the MPU struct being configured.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Status of the function call.</dd></dl>
<table class="doxtable">
<tr>
<th>Status </th><th>Description  </th></tr>
<tr>
<td>CY_PROT_SUCCESS </td><td>The MPU struct was disabled. </td></tr>
<tr>
<td>CY_PROT_FAILURE </td><td>The MPU struct is enabled and possibly locked. </td></tr>
</table>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    </div><div class="line">    <span class="comment">/* Scenario: PROT_MPU1_MPU_STRUCT0 needs to be disabled. Or it needs to be</span></div><div class="line"><span class="comment">                 reconfigured and hence must first be disabled. */</span></div><div class="line">    </div><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__prot__enums.html#gga13ede85383a4afaf5ed3a14b470e38bda462f07fcb31ed8a07dd273af4290691d">CY_PROT_SUCCESS</a> != <a class="code" href="group__group__prot__functions__mpu.html#ga515c855a5703ee9dd3dd905aa50367a1">Cy_Prot_DisableMpuStruct</a>(PROT_MPU1_MPU_STRUCT0))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div><div class="line"></div></div><!-- fragment --></dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
